<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>controlP5 : : Radio</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
document.getElementsByTagName('html')[0].className = 'isjs';

function toggle(dt) 
{ 
  var display, dd=dt; 
  /* get dd */ 
  do{ dd = dd.nextSibling } while(dd.tagName!='DD'); 
  toOpen =!dd.style.display; 
  dd.style.display = toOpen? 'block':'' 
  dt.getElementsByTagName('span')[0].innerHTML 
    = toOpen? '-':'+' ; 
} 
</script>
</head>
<body>
<div id="container">
		<div id="header">
		<a href="./index.htm"><img src="./docuImages/title.jpg" /></a>
		</div>
	<div class="content">
		<h1>Radio</h1>
		<dl><dt class="key">description</dt><dd class="value">a radio button implementation.</dd></dl>
			
			<div class="toggleList example">
				<dl><dt onclick="toggle(this)"><span>+</span>Example</dt>
					<dd><pre>import controlP5.*;

ControlP5 controlP5;

int myColorBackground = color(0,0,0);

void setup() {
  size(400,400);
  smooth();
  controlP5 = new ControlP5(this);
  Radio r = controlP5.addRadio("radio",100,160);
  r.deactivateAll(); // use deactiveAll to not make the first radio button active.
  r.add("black",0);
  r.add("red",1);
  r.add("green",2);
  r.add("blue",3);
  r.add("grey",4);
}

void draw() {
  background(myColorBackground);
}

void radio(int theID) {
  switch(theID) {
    case(0):
      myColorBackground = color(0);    
      break;  
    case(1):
      myColorBackground = color(255,0,0);
      break;  
    case(2):
      myColorBackground = color(0,255,0);
      break;  
    case(3):
      myColorBackground = color(0,0,255);
      break;  
    case(4):
      myColorBackground = color(128);
      break;
  }
  println("a radio event.");
}
</pre></dd>
				</dl>
			</div>
			
			
			
			<dl><dt class="key">constructors</dt><dd class="value"><pre>Radio(theControlP5, theParent, theName, theX, theY, theWidth, theHeight, theLineSpacing);
</pre></dd></dl>
			
			
			
			
			
			
			
			<!-- METHODS:BEGIN -->
			
       <dl class="noborder"><dt>Methods</dt></dl>
       <dl><dt class="key"><a href="radio_method_activate.htm">activate ( )</a></dt><dd class="value">activate a radio button by name.</dd></dl>
<dl><dt class="key"><a href="radio_method_additem.htm">addItem ( )</a></dt><dd class="value">add a new radio button item.</dd></dl>
<dl><dt class="key"><a href="radio_method_current.htm">current ( )</a></dt><dd class="value">get current radio button.</dd></dl>
<dl><dt class="key"><a href="radio_method_deactivate.htm">deactivate ( )</a></dt><dd class="value">deactivate a RadioButton and set the value of the radio controller to
 the default value.</dd></dl>
<dl><dt class="key"><a href="radio_method_setdefaultvalue.htm">setDefaultValue ( )</a></dt><dd class="value">set the default value of a Radio controller, in case no radio button is
 selected.</dd></dl>

   
			<!-- METHODS:END -->
			<div class="separator">
			<dl><dt class="key">usage</dt><dd class="value">Web & Application</dd></dl>
			</div>
			<div class="separator">
			<dl><dt class="key">related</dt><dd class="value"><ul><li><a href="controlp5_class_controlp5.htm">ControlP5</a></li>
<li><a href="bang_class_bang.htm">Bang</a></li>
<li><a href="button_class_button.htm">Button</a></li>
<li><a href="knob_class_knob.htm">Knob</a></li>
<li><a href="numberbox_class_numberbox.htm">Numberbox</a></li>
<li><a href="radio_class_radio.htm">Radio</a></li>
<li><a href="slider_class_slider.htm">Slider</a></li>
<li><a href="tab_class_tab.htm">Tab</a></li>
<li><a href="textfield_class_textfield.htm">Textfield</a></li>
<li><a href="toggle_class_toggle.htm">Toggle</a></li>
<li><a href="controller_class_controller.htm">Controller</a></li>
</ul></dd></dl>
			</div>
	</div>
	<div id="footer">
	<p>by andreas schlegel (<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="_blank">cc</a>) 2007, <a href="http://www.sojamo.de" target="_blank">sojamo</a>.</p>
	</div>
</div>
</body>
</html>


